import java.util.Scanner;

/**
 * Author: 王俊超
 * Date: 2015-12-25 16:59
 * All Rights Reserved !!!
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
//        Scanner scanner = new Scanner(Main.class.getClassLoader().getResourceAsStream("data.txt"));
        while (scanner.hasNext()) {
            String input = scanner.nextLine();
            try {
                System.out.println(sum(Integer.parseInt(input)));
            } catch (Exception e) {
                System.out.println("-1");
            }
        }

        scanner.close();
    }

    private static int sum(int n) {
        return (3 * n + 1) * n / 2;
    }
}
